#include <iostream>
#include <memory>
#include <string>
#include <functional>
#include "UdpServer.hpp"
#include "MessageRoute.hpp"

void Useage(const std::string& s)
{
    std::cout << s << ":\n\t" << s << " port\n";
}

int main(int argc, char* argv[])
{
    if(argc != 2)
    {
        Useage(argv[0]);
        exit(0);
    }

    MessageRoute mr;

    uint16_t port = std::stoi(argv[1]);
    std::unique_ptr<UdpServer> uq = std::make_unique<UdpServer>(port, \
        std::bind(&MessageRoute::Route, &mr, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
    uq->InitServer();
    uq->Start();
    
    return 0;
}